import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login'
import Home from '@/views/home'
import NotFound from '@/views/notfound'
import user from '@/views/user'
import Movie from '@/views/movie'
import Cinema from '@/views/cinema'
import Screens from '@/views/screens'
import Row from '@/views/row'
import Order from '@/views/order'
import Comments from '@/views/comments'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: { name: 'user' },
    children: [
      {
        path: 'user',
        name: 'user',
        component: user,
        meta: {
          name: '用户管理'
        }
      },
      {
        path: 'movie',
        name: 'Movie',
        component: Movie,
        meta: {
          name: '电影管理'
        }
      },
      {
        path: 'cinema',
        name: 'Cinema',
        component: Cinema,
        meta: {
          name: '影院管理'
        }
      },
      {
        path: 'screens',
        name: 'Screens',
        component: Screens,
        meta: {
          name: '影厅管理'
        }
      },
      {
        path: 'row',
        name: 'Row',
        component: Row,
        meta: {
          name: '电影排片'
        }
      },
      {
        path: 'comments',
        name: 'Comments',
        component: Comments,
        meta: {
          name: '评论管理'
        }
      },
      {
        path: 'order',
        name: 'Order',
        component: Order,
        meta: {
          name: '订单管理'
        }
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '*',
    name: 'NotFound',
    component: NotFound
  }
]

const router = new VueRouter({
  routes
})

export default router
